﻿using System;
using System.ComponentModel.Composition;
using System.Windows;
using GalaSoft.MvvmLight.Messaging;
using MapInfo.Toolbox.Core;
using MapInfo.Toolbox.UI.Services;
using MapInfo.Toolbox.UI.ViewModels;

namespace MapInfo.Toolbox.UI.SandBox
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private ModuleTreeViewModel _moduleTreeViewModel;
        private MEFModuleLoader _mefModuleLoader;

        [Export(typeof(IToolboxModule))]
        public class DummyModule : ToolboxModule
        {
            public override string Name { get; set; }
            public override string Description { get; set; }
            public override int Version { get; set; }
            public override void Run()
            {
                throw new NotImplementedException();
            }
        }

        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _mefModuleLoader = new MEFModuleLoader();
            _moduleTreeViewModel = new ModuleTreeViewModel(_mefModuleLoader);
            this.moduleTreeView1.DataContext = _moduleTreeViewModel;
            _moduleTreeViewModel.LoadModules();
        }
    }
}
